I am using the Word export dxl file and a template. I am trying to place a line of text about the baseline used during export at the specific location: after the table of contents but before section 1 (the first row in the main column exported by DOORS). Currently I am able to write the line of text to the top of the document but not where I want it. Does anyone have any advice on how to modify the Word export dxl code to do this? I am not sure if I should add a bookmark or modify the template. Thanks for your help!
|
Re: place additional text at specific location in template using Word export <<BaselineInfo>> or <<MyCustomAttribute>> WEXP will then after the export, use the Word Search to look for all fields in the Template that are encapsulated in <<...>> and then check the content if
I think you get the idea. This will make you very flexible in inserting the text in the template in a position that you like, using a formatting that you like. Maybe that helps, Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: place additional text at specific location in template using Word export Mathias Mamsch - Thu Jan 24 17:31:42 EST 2013
I think you get the idea. This will make you very flexible in inserting the text in the template in a position that you like, using a formatting that you like. Maybe that helps, Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS What if the special tag is in the WEXP file and not in the module. For example: This is my snippet of code added to the WEXP file: //---------------------Definitions--------------------- string results = "",tempFilter = "", myPath = "", myName = "" Filter myFilt = current //---------------------get & display module information--------------------- //display the path of the Module myPath = path(Module m) clear objArgBlock put(objArgBlock, "Path of Module: " myPath "\n") oleMethod(objSel, "TypeText", objArgBlock) //display the name of the Module myName = name(Module m) clear objArgBlock put(objArgBlock, "Name of Module: " myName "\n") oleMethod(objSel, "TypeText", objArgBlock) //get the baseline applied at export //determine if a baseline exists or not. If it does not exist, the module is the current version Baseline b = getMostRecentBaseline(m) if b == null then { clear objArgBlock put(objArgBlock, "The Module is the current version at the time of export. \n") checkRes(oleMethod(objSel, "TypeText", objArgBlock)) } else { clear objArgBlock put(objArgBlock, "Module version at the time of export: " version(m) "\n") checkRes(oleMethod(objSel, "TypeText", objArgBlock)) } //display the filter or if no filter was applied during export bool answer = filtering(m) if answer == false then { clear objArgBlock put(objArgBlock, "The filter was not applied at export \n") oleMethod(objSel, "TypeText", objArgBlock) } else { if (! null myFilt) { tempFilter = stringOf(m,myFilt) results = results "DOORS filter applied at export: " tempFilter tempFilter = "" } else { results = results "No filter\n\n" } } //display the description of the filter being applied clear objArgBlock put(objArgBlock, results "\n") oleMethod(objSel, "TypeText", objArgBlock) This is what I used to write the information I wanted to the word document before and it worked well. Now that I must reposition my text to a different location in the word document using <<>> like you suggested, what should I enter in the <<>> of the template? I tried my variable names, the actual function, etc. Is this even possible to take information from the WEXP script and place it in the word document using <<>> or should I be taking a different approach? Thank you |
Re: place additional text at specific location in template using Word export SystemAdmin - Tue Jan 29 12:02:42 EST 2013
Well this page here, shows how to do a search replace in Word:
[<]{2;2}[!>]@[>]{2;2}
bool moreFound = true
while (true) {
oleCheck oleMethod(myFindObject, "Execute", findArguments) // Execute the search
oleCheck oleGet(myFindObject, "Found", moreFound)
if (!moreFound) break;
// get the text from the range
oleGet (myRange, "Text", selectionText)
if (selectionText == "Baseline Info") {
// ... export baseline information to the range...
}
if (selectionText[0:3] == "mod.") {
// ... read attribute and export its value to the range ...
}
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: place additional text at specific location in template using Word export Mathias Mamsch - Tue Jan 29 14:34:06 EST 2013
Well this page here, shows how to do a search replace in Word:
[<]{2;2}[!>]@[>]{2;2}
bool moreFound = true
while (true) {
oleCheck oleMethod(myFindObject, "Execute", findArguments) // Execute the search
oleCheck oleGet(myFindObject, "Found", moreFound)
if (!moreFound) break;
// get the text from the range
oleGet (myRange, "Text", selectionText)
if (selectionText == "Baseline Info") {
// ... export baseline information to the range...
}
if (selectionText[0:3] == "mod.") {
// ... read attribute and export its value to the range ...
}
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
For example he put variable "Document Name" in the 1st page and in the Footer. His DXL did this:
-Louie |
Re: place additional text at specific location in template using Word export llandale - Tue Jan 29 16:00:55 EST 2013
-Louie
Hi,
//----------------------------------------------------------------
// Searches for a string in the doc from the top
//----------------------------------------------------------------
void wordFindString(string arg) {
OleAutoObj objSelection = null
OleAutoObj objFind = null
if (arg == "") {
endKey()
return
}
oleGet (objWord, "Selection", objSelection)
if (objSelection == null) {
print "selection = null\n"
return
}
oleGet(objSelection, "Find", objFind)
if (objFind == null) {
print "find = null\n"
return
}
olePut(objFind, "Text", arg)
olePut(objFind, "Wrap", wdFindContinue)
oleMethod(objFind, cMethodExecute)
}
// Put a tag such as %%the tag to replace%% in you dot somewhere
wordFindString("%%the tag to replace%%")
// write the string you need to write here with the function you use to output a string to MSWord
|
Re: place additional text at specific location in template using Word export adevicq - Wed Jan 30 06:54:57 EST 2013
Hi,
//----------------------------------------------------------------
// Searches for a string in the doc from the top
//----------------------------------------------------------------
void wordFindString(string arg) {
OleAutoObj objSelection = null
OleAutoObj objFind = null
if (arg == "") {
endKey()
return
}
oleGet (objWord, "Selection", objSelection)
if (objSelection == null) {
print "selection = null\n"
return
}
oleGet(objSelection, "Find", objFind)
if (objFind == null) {
print "find = null\n"
return
}
olePut(objFind, "Text", arg)
olePut(objFind, "Wrap", wdFindContinue)
oleMethod(objFind, cMethodExecute)
}
// Put a tag such as %%the tag to replace%% in you dot somewhere
wordFindString("%%the tag to replace%%")
// write the string you need to write here with the function you use to output a string to MSWord
-Louie Seems to me this function should return a boolean success flag. |
Re: place additional text at specific location in template using Word export llandale - Wed Jan 30 09:54:50 EST 2013
Yes. It selects the text and when you output some text to MS Word it erases the selected text (in fact it pastes the new text and therefore replaces the selection).
//----------------------------------------------------------------
// Searches for a string in the doc from the top
//----------------------------------------------------------------
bool wordFindString(string arg) {
OleAutoObj objSelection = null
OleAutoObj objFind = null
bool bResult = false
if (arg == "") {
endKey()
return false
}
oleGet (objWord, "Selection", objSelection)
if (objSelection == null) {
print "selection = null\n"
return false
}
oleGet(objSelection, "Find", objFind)
if (objFind == null) {
print "find = null\n"
return false
}
olePut(objFind, "Text", arg)
olePut(objFind, "Wrap", wdFindContinue)
oleMethod(objFind, cMethodExecute, null, bResult)
if (bResult == false)
print "The tag " arg " has not been found\n"
return bResult
}
|
Re: place additional text at specific location in template using Word export adevicq - Thu Jan 31 04:49:22 EST 2013
Yes. It selects the text and when you output some text to MS Word it erases the selected text (in fact it pastes the new text and therefore replaces the selection).
//----------------------------------------------------------------
// Searches for a string in the doc from the top
//----------------------------------------------------------------
bool wordFindString(string arg) {
OleAutoObj objSelection = null
OleAutoObj objFind = null
bool bResult = false
if (arg == "") {
endKey()
return false
}
oleGet (objWord, "Selection", objSelection)
if (objSelection == null) {
print "selection = null\n"
return false
}
oleGet(objSelection, "Find", objFind)
if (objFind == null) {
print "find = null\n"
return false
}
olePut(objFind, "Text", arg)
olePut(objFind, "Wrap", wdFindContinue)
oleMethod(objFind, cMethodExecute, null, bResult)
if (bResult == false)
print "The tag " arg " has not been found\n"
return bResult
}
|